
#emotionAnalysis.r create by zhenghaimin
#
kind_num <- 7;
happy <- c("PA", "PE");
good <- c("PD", "PH", "PG", "PB", "PK");
angry <- c("NA");
sad <- c("NB", "NJ", "NH", "PF");
fear <- c("NI", "NC", "NG");
boring <- c("NE", "ND", "NN", "NK", "NL");
suprise <- c("PC");
kind_list <- list(happy, good, angry, sad, fear, boring, suprise);
print(happy)

happy_counter <- 0;
good_counter <- 0;
angry_counter <- 0;
sad_counter <- 0;
fear_counter <- 0;
boring_counter <- 0;
suprise_counter <- 0;
counter_list <- c(happy_counter, good_counter, angry_counter, sad_counter, fear_counter, 
    boring_counter, suprise_counter);
print(counter_list)

for (i in 1: length(mergeframe$kind)) {
    kind <- mergeframe$kind[i];
    for (j in 1: kind_num) {
        result <- match(kind, unlist(kind_list[j]), nomatch = -1);
        if (result != -1) {
            counter_list[j] = counter_list[j] + 1;
            print(kind_list[j]);
        }
    }
}

print(counter_list);